<?php

namespace common\models\sys;

use Yii;

/**
 * This is the model class for table "modelhistory".
 *
 * @property int $id
 * @property int $user_id 用户id
 * @property string $op_type INSERT,UPDATE,DELETE
 * @property string $op_table_name 表名称
 * @property string $primary_key 主键
 * @property string $unique 唯一值(spu,sku)
 * @property array $old_value 原始值
 * @property array $new_value
 * @property string $created_at
 */
class ModelHistory extends \yii\db\ActiveRecord
{



    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%model_history}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_id'], 'integer'],
            [['op_type', 'op_table_name', 'created_at'], 'required'],
            [['old_value', 'new_value', 'created_at'], 'safe'],
            [['op_type','os_type'], 'string', 'max' => 20],
            [['op_table_name', 'primary_key', 'unique','op_modules'], 'string', 'max' => 100],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app/product', 'id'),
            'user_id' => Yii::t('app/log', 'auditor'),
            'op_type' => Yii::t('app/log', 'op_type'),
            'op_table_name' => Yii::t('app/log', 'op_table_name'),
            'op_modules' => Yii::t('app/log', 'op_modules'),
            'os_type' => Yii::t('app/log', 'os_type'),
            'primary_key' => Yii::t('app/log', 'primary_key'),
            'unique' => Yii::t('app/log', 'unique'),
            'old_value' => Yii::t('app/log', 'old_value'),
            'new_value' => Yii::t('app/log', 'new_value'),
            'created_at' => Yii::t('app', 'created_at'),
        ];
    }
    
}
